using System;
using OracleInternal.Common;
using OracleInternal.ServiceObjects;

namespace Oracle.ManagedDataAccess.Client
{
	public sealed class OracleGlobalization : ICloneable, IDisposable
	{
		private bool m_disposed;

		internal OracleGlobalizationImpl m_oracleGlobalizationImpl;

		public string Calendar
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_calendar == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_calendar;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_calendar = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string Comparison
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_comparison == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_comparison;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_comparison = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string Currency
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_currency == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_currency;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_currency = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string DateFormat
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_dateFormat == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_dateFormat;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_dateFormat = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string DateLanguage
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_dateLanguage == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_dateLanguage;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_dateLanguage = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string DualCurrency
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_dualCurrency == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_dualCurrency;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_dualCurrency = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string ISOCurrency
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_isoCurrency == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_isoCurrency;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_isoCurrency = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string Language
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_language == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_language;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_language = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string LengthSemantics
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_lengthSemantics == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_lengthSemantics;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_lengthSemantics = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public bool NCharConversionException
		{
			get
			{
				return m_oracleGlobalizationImpl.m_nCharConvException;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_nCharConvException = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string NumericCharacters
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_numericCharacters == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_numericCharacters;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_numericCharacters = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string Sort
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_sort == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_sort;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_sort = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string Territory
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_territory == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_territory;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_territory = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string TimeStampFormat
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_timeStampFormat == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_timeStampFormat;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_timeStampFormat = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string TimeStampTZFormat
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_timeStampTZFormat == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_timeStampTZFormat;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_timeStampTZFormat = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		public string TimeZone
		{
			get
			{
				if (m_oracleGlobalizationImpl.m_timeZone == null)
				{
					return string.Empty;
				}
				return m_oracleGlobalizationImpl.m_timeZone;
			}
			set
			{
				if (!m_disposed)
				{
					m_oracleGlobalizationImpl.m_timeZone = value;
					return;
				}
				throw new ObjectDisposedException(GetType().Name);
			}
		}

		internal OracleGlobalization(OracleGlobalizationImpl oracleGlobImpl)
		{
			m_oracleGlobalizationImpl = oracleGlobImpl;
		}

		public object Clone()
		{
			OracleGlobalizationImpl oracleGlobImpl = null;
			try
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleGlobalization, OracleTraceFuncName.Clone);
				}
				if (m_oracleGlobalizationImpl != null)
				{
					oracleGlobImpl = (OracleGlobalizationImpl)m_oracleGlobalizationImpl.Clone();
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleGlobalization, OracleTraceFuncName.Clone, ex);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleGlobalization, OracleTraceFuncName.Clone);
				}
			}
			return new OracleGlobalization(oracleGlobImpl);
		}

		public void Dispose()
		{
			try
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Entry, OracleTraceClassName.OracleGlobalization, OracleTraceFuncName.Dispose);
				}
				if (!m_disposed)
				{
					m_disposed = true;
					if (m_oracleGlobalizationImpl != null)
					{
						m_oracleGlobalizationImpl.Dispose();
					}
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Public, OracleTraceTag.Error, OracleTraceClassName.OracleGlobalization, OracleTraceFuncName.Dispose, ex);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPublic)
				{
					Trace.Write(OracleTraceLevel.Public, OracleTraceTag.Exit, OracleTraceClassName.OracleGlobalization, OracleTraceFuncName.Dispose);
				}
			}
		}
	}
}
